<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="pragma" content="no-cache"/>
    <meta http-equiv="cache-control" content="no-cache"/>
    <meta http-equiv="expires" content="0"/>
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
    <meta http-equiv="description" content="This is my page"/>

    <link rel="stylesheet" type="text/css" href="<%=path %>/css/base.css"/>
    <script language="JavaScript" src="<%=path %>/js/public.js" type="text/javascript"></script>
    <script language="javascript">
        function orderDel(orderId) {
            if (confirm('您确定打回吗？')) {
                window.location.href = "<%=path %>/order/chgStatus.do?page=0&id=" + orderId + "&status=-1";
            }
        }

        function orderShouli(orderId) {
            if (confirm('您确定受理产品吗？')) {
                window.location.href = "<%=path %>/order/chgStatus.do?page=0&id=" + orderId + "&status=1";
            }
        }


        function orderDetail(orderId) {
            var url = "<%=path %>/order/getApplyDetail.do?id=" + orderId;
            var n = "";
            var w = "700px";
            var h = "700px";
            var s = "resizable:no;help:no;status:no;scroll:yes";
            openWin(url, n, w, h, s);
        }

        function editOrder(orderId) {
            var url = "<%=path %>/order/editOrder.do?id=" + orderId;
            var n = "";
            var w = "700px";
            var h = "700px";
            var s = "resizable:no;help:no;status:no;scroll:yes";
            openWin(url, n, w, h, s);
        }

        function publicOrder(orderId) {
            if (confirm('您确定发布产品吗？')) {
                window.location.href = "<%=path %>/order/chgStatus.do?page=1&id=" + orderId + "&status=2";
            }
        }

        function editDetail(orderId) {
            var url = "<%=path %>/machine/variant/builder.jsp?id=" + orderId;
            var n = "";
            var w = "700px";
            var h = "700px";
            var s = "resizable:no;help:no;status:no;scroll:yes";
            openWin(url, n, w, h, s);
        }

        function userXinxi(userId) {
            var url = "<%=path %>/userXinxi.action?userId=" + userId;
            var n = "";
            var w = "300px";
            var h = "400px";
            var s = "resizable:no;help:no;status:no;scroll:yes";
            openWin(url, n, w, h, s);
        }
    </script>
</head>

<body leftmargin="2" topmargin="2" background='<%=path %>/images/allbg.gif'>
<table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
    <tr bgcolor="#E7E7E7">
        <td height="14" colspan="7" background="<%=path %>/images/tbg.gif">&nbsp;产品管理&nbsp;</td>
    </tr>
    <tr align="center" bgcolor="#FAFAF1" height="22">
        <td width="8%">产品ID</td>
        <td width="10%">产品名称</td>
        <td width="10%">产品描述</td>
        <td width="16%">下单日期</td>
        <td width="22%">操作</td>
    </tr>
    <c:forEach var="item" items="${data}">
        <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';"
            onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
            <td bgcolor="#FFFFFF" align="center">
                <a href="#" onclick="userXinxi(${item.order_id})" style="color: red">${item.order_id}</a>
            </td>
            <td bgcolor="#FFFFFF" align="center">
                    ${item.order_name}
            </td>
            <td bgcolor="#FFFFFF" align="center">
                    ${item.order_detail}
            </td>
            <td bgcolor="#FFFFFF" align="center">
                    ${item.create_time}
            </td>
            <c:if test="${page == 0}">
                <td bgcolor="#FFFFFF" align="center">
                    <a href="#" onclick="orderDetail(${item.order_id})" class="pn-loperator">产品明细</a>

                    <c:if test="${item.status == 0}">
                        <a href="#" onclick="orderShouli(${item.order_id})"
                           class="pn-loperator">受理产品</a>
                    </c:if>
                    <a href="#" onclick="orderDel(${item.order_id})" class="pn-loperator">打回产品</a>
                </td>
            </c:if>
            <c:if test="${page == 1}">
                <td bgcolor="#FFFFFF" align="center">
                    <a href="#" onclick="editOrder(${item.order_id})"
                       class="pn-loperator">编辑</a>
                    <a href="#" onclick="editDetail(${item.order_id})" class="pn-loperator">编辑详情</a>
                    <a href="#" onclick="publicOrder(${item.order_id})" class="pn-loperator">发布</a>
                </td>
            </c:if>
            <c:if test="${page == 2}">
                <td bgcolor="#FFFFFF" align="center">
                    <a href="#" onclick="editOrder(${item.order_id})"
                       class="pn-loperator">查看</a>
                    <a href="#" onclick="publicOrder(${item.order_id})" class="pn-loperator">修改</a>
                </td>
            </c:if>
        </tr>
    </c:forEach>
    <%--<s:iterator value="#request.orderList" id="order">--%>
    <%----%>
    <%--</s:iterator>--%>
</table>
</body>
</html>
